package xyz.zyt123.videowall.util;

import javafx.scene.image.Image;
import javafx.scene.paint.Color;


public class CheckUtil {
    public static boolean check(Image image) {
        double width = image.getWidth();
        double height = image.getHeight();
        double sum = 0;
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                Color argb = image.getPixelReader().getColor(i, j);
                double brightness = argb.getBrightness();
                sum += brightness;
            }
        }
        double grayAvg = sum / (width * height);
        return grayAvg < 0.2;
    }
}
